﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace RM2012Mobile
{
    public partial class frmMenu : Form
    {
        RM2012Service.RM2012Service objService = new RM2012Service.RM2012Service();
        DataSet ds;

        public frmMenu()
        {
            InitializeComponent();
        }

        private void frmMenu_Load(object sender, EventArgs e)
        {
            RefreshGrid();
        }

        private void gridMenu_CurrentCellChanged(object sender, EventArgs e)
        {
            //int rowIndex = gridMenu.CurrentRowIndex;
            //string menuName = gridMenu[rowIndex, 1].ToString();
            //string price = gridMenu[rowIndex, 3].ToString();
            //price = price.Substring(0, price.LastIndexOf("."));
            //string unitName = gridMenu[rowIndex, 4].ToString();
            //string notice = menuName + " - " + "Giá : " + price + "/" + unitName;
            //MessageBox.Show(notice);
        }

        public void RefreshGrid()
        {
            ds = new DataSet();
            ds = objService.GetAllMenuDataSet();
            gridMenu.DataSource = ds.Tables[0];
        }

        private void menuItemRefresh_Click(object sender, EventArgs e)
        {
            RefreshGrid();
        }

        private void menuItemClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}